package com.sky.wsp.mybatis.plus.dao.vo;

import java.util.List;

/**
 * @author wangshaopeng@talkweb.com.cn
 * @desccription 任务进度VO
 * @date 2023/5/5
 */
public class TaskProgressVO {
    private String id;
    private String itemCode;
    private String itemType;
    private String parentId;
    private String title;
    private String handledBy;
    private String status;
    private Integer leafCount;
    // 工作量估时（按工作日）
    private Integer workDay;
    // 已完成工作量
    private Integer completeDay;
    private List<TaskProgressVO> children;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getItemCode() {
        return itemCode;
    }

    public void setItemCode(String itemCode) {
        this.itemCode = itemCode;
    }

    public String getItemType() {
        return itemType;
    }

    public void setItemType(String itemType) {
        this.itemType = itemType;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getHandledBy() {
        return handledBy;
    }

    public void setHandledBy(String handledBy) {
        this.handledBy = handledBy;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Integer getCompleteDay() {
        return completeDay;
    }

    public void setCompleteDay(Integer completeDay) {
        this.completeDay = completeDay;
    }

    public Integer getWorkDay() {
        return workDay;
    }

    public void setWorkDay(Integer workDay) {
        this.workDay = workDay;
    }

    public Integer getLeafCount() {
        return leafCount;
    }

    public void setLeafCount(Integer leafCount) {
        this.leafCount = leafCount;
    }

    public List<TaskProgressVO> getChildren() {
        return children;
    }

    public void setChildren(List<TaskProgressVO> children) {
        this.children = children;
    }

    /**
     * 进度百分比
     *
     * @return
     */
    public String getPercentage() {
        if (null == completeDay || null == workDay || 0 == workDay) {
            return "0.00";
        }
        return String.format("%.4f", Float.valueOf(completeDay) / workDay);
    }

    @Override
    public String toString() {
        return "'" + id
                + "\t'" + itemCode
                + "\t" + itemType
                + "\t'" + parentId
                + "\t" + title
                + "\t'" + handledBy
                + "\t" + status
                + "\t" + leafCount
                + "\t" + workDay
                + "\t" + completeDay
                + "\t" + getPercentage();
    }
}
